import { Tabs ,Radio, Button} from "antd-mobile"
import styles from './css/Home.module.css'
import { LoopOutline } from "antd-mobile-icons";
import { useDispatch, useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import { upLpadCRH } from "../../store/slice/ticket";

const Home=()=>{
    let dispatch = useDispatch();
    let onlyCRH = useSelector((store) => store.ticket.onlyCRH);
    const nav=useNavigate()
    let golist=()=>{
      nav(`/query?start=北京&end=上海市&date=${Date.now()}&isSpeed=${onlyCRH}`)
    }
    return <div>
         <Tabs>
          <Tabs.Tab title='机票' key='机票'>
            菠萝
          </Tabs.Tab>
          <Tabs.Tab title='国内火车' key='国内火车'>
            <Tabs>
                <Tabs.Tab title='单程' key='单程'>
                    <div className={styles.row1}>
                        <span>北京</span>
                        <LoopOutline />
                        <span>上海</span>
                    </div>
                    <div className={styles.row2}>
                    <span className={styles.ss}>5月13日</span>
                    <span>今天</span>
                    </div>
                    <div className={styles.row3}>
                <span>
                  {" "}
                  <Radio>学生票</Radio>
                </span>
                <span>
                  {" "}
                  <Radio
                    checked={onlyCRH}
                    onChange={(val) => dispatch(upLpadCRH(val))}
                  >
                    只看高铁动车
                  </Radio>
                </span>
              </div>
                </Tabs.Tab>
                <Tabs.Tab title='往返' key='往返'>
                蚂蚁
                </Tabs.Tab>
            </Tabs>
          </Tabs.Tab>
          <Tabs.Tab title='国际/港台' key='国际/港台'>
            蚂蚁
          </Tabs.Tab>
          <Tabs.Tab title='汽车票' key='汽车票'>
            蚂蚁
          </Tabs.Tab>
        </Tabs>
        <Button
        style={{
          width: "300px",
          marginLeft: "30px",
          background: "#8AC951",
          borderRadius: "15px",
        }}
        onClick={golist}
      >
        搜索
      </Button>
    </div>
}
export default Home